package com.xiaomimall.front.Malltype;

import com.xiaomi.front.dao.Malltype.MalltypeDao;
import com.xiaomi.front.service.malltype.MalltypeService;
import com.xiaomi.pojo.Commoditys;
import com.xiaomi.pojo.Malltype;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MalltypeServicetest {

    private ApplicationContext context ;

    @Before
    public void init() {

        context = new ClassPathXmlApplicationContext("spring-config-all.xml") ;
    }

    @Test
    public void getBookCategorys() {
        List<Malltype> malltype=context.getBean(MalltypeService.class).MalltypeAll();
        for(Malltype malltype1:malltype){
            System.out.println(malltype1.getPbname());
            for (Commoditys commoditys:malltype1.getCommoditys()){
                System.out.println(commoditys.toString());
            }
        }
    }
}
